﻿using System.Data.SqlClient;

namespace CoreLibrary.Sql {

    public interface ISqlCommand<T, R>{

        /// <summary>
        /// Get the raw query.
        /// </summary>
        /// <returns></returns>
        string GetSQL();

        /// <summary>
        /// Fill parameters into the given command.
        /// </summary>
        /// <param name="command"></param>
        void SetParameters(SqlCommand command);

        /// <summary>
        /// Extract data out of the given result returned 
        /// by the query and return an object.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="conn"></param>
        /// <returns></returns>
        T GetResult(SqlConnection conn, R result);

    }

}